-- This script will kick the user into help (or wherever else the user
-- needs to be kicked) if he or she aimlessly clicks the mouse too
-- many times in short order. (It will also, just for a meaningless
-- demonstration, do the same if the user taps that totally useless
-- "enter" key.)
--
-- This script was written after watching one utterly confused lady
-- try out HyperCard on a dealer's demonstration Mac one day. She was
-- very upset when she repeatedly pushed that big button on the uh,
-- mouse, yeah, that's right - but nothing happened. The fact that
-- the stack had no readily visible buttons only contributed to her
-- confusion. I figured there had to be a way to help those sorts of
-- disadvantaged people find the one true path, hence the birth of
-- this modest little script.
--
-- (Thanks be to Bill Atkinson for HyperCard, and to Bo3b Johnson for
-- getting me interested in the Mac in the first place.)
on openCard
global maxNumClicks
global delay
-- The number of aimless clicks before the help is triggered
-- is in "maxNumClicks".
-- "Delay" is the number of seconds after the last aimless click at
-- which the click counter is cleared.
-- Set up those globals where we can get at 'em easy.
put 3 into maxNumClicks -- a pure, unadulterated number
put 3 into delay -- seconds - a number with meaning
-- Hide the help until the user has acted "confused".
hide card field "About AutoHelp Demo"
set the lockText of card field "About AutoHelp Demo" to true
end openCard
on mouseUp
global timeOut
global aimlessClicks
global maxNumClicks
global delay
-- The count of aimless clicks since the last time out is in
-- "aimlessClicks".
-- The time at which the count is to be zeroed is stored in
-- "timeOut".
-- Maybe the click is not aimless. After all, if the user _has_
-- found the option key.
if the optionKey is down then
edit script of target
exit mouseUp
end if
-- Check to see if the help has already been activated, and bail
-- out if so
if the visible of card field "About Autohelp Demo" is true then exit mouseup
-- Set the time at which aimlessClicks will be reset if this just
-- happens to be the user's last aimless click.
put the seconds + delay into timeOut
add 1 to aimlessClicks
-- Check aimlessClicks against the trigger level and declare the
-- user confused if necessary.
if aimlessClicks >= maxNumClicks then
put 0 into aimlessClicks
confusedUser
end if
end mouseUp
on idle
global timeOut
global aimlessClicks
-- Reset aimlessClicks if the user hasn't clicked in a short while.
if the seconds > timeOut then put 0 into aimlessClicks
pass idle -- Or don't if you don't want to
end idle
on enterKey
-- Yes, you can do it by pressing a key too.
if the visible of card field "About AutoHelp Demo" is false then confusedUser
end enterKey
on confusedUser
-- The user is lost (by definition!), so give him or her a chance
-- for help.
-- No offense intended here, but if you want to take offense
-- anyway you're certainly welcome to as much as you can carry.
answer "Do you need help?" with "Oh God Yes" or "Uh uh"
if it is "Oh God Yes" then
-- Set up your own dirty work here...
show card field "About AutoHelp Demo"
end if
end confusedUser
on CloseStack
-- An added bonus! Since so many stacks were uploaded to BBSes and
-- so on without being compacted first, my friends (yes, I have a
-- few of those) and I decided this neat little reminder would be
-- used, without complaint, by the chronically forgetful among us.
put the short name of this stack into stackName
answer "Compact" && stackName && "first?" with "Please Do" or "No Thanks"
if it is "Please Do" then domenu compact stack
pass CloseStack
end CloseStack
-- part 14 (field)
-- low flags: 81
-- high flags: 2007
-- rect: left=283 top=86 right=262 bottom=493
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: About AutoHelp Demo
----- HyperTalk script -----
on mouseUp
if the optionKey is down then
pass mouseUp
end if
hide card field "About Autohelp Demo"
end mouseUp
-- part 15 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=269 top=28 right=62 bottom=480
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 12
-- style flags: 2304
-- line height: 16
-- part name:
-- part 16 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=254 top=286 right=322 bottom=490
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 12
-- style flags: 2304
-- line height: 16
-- part name:
-- part 17 (button)
-- low flags: 00
-- high flags: 0003
-- rect: left=25 top=47 right=75 bottom=61
-- title width / last selected line: 0
-- icon id / first selected line: 21847 / 21847
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: New Button
----- HyperTalk script -----
on mouseUp
if the optionKey is down then
pass mouseUp
end if
if the commandKey is down then go home
else pass mouseUp
end mouseUp
-- part contents for card part 14
----- text -----
Welcome to the AutoHelp Demonstration stack. Autohelp is a script that resides in the card or stack, intercepts aimless mouse clicks, and gives the user the option of getting help if too many aimless clicks are made. Believe it or not, it actually has helped a few first time Mac/HyperCard users. (OK, so I lied.)
So How's it Done?
Option-click somewhere on the card to get a look at the script that makes it all possible.
About the About:
This is the "About AutoHelp Demo" field. If you don't believe me, then check it out yourself (I dare ya). Click on it to get rid of it.
Ruby Slippers:
Command-click on the house when you've had enough and want to go home.
Obligatory Disclaimer:
This demonstration script works, but I can't be held responsible for what horrors you perpetrate on your own stacks - especially since this script is in the public domain.
About the Picture:
Just in case you were wondering, the picture on this card has nothing to do with what the stack demonstrates. The picture does, however, have a lot to do with the currently moribund US space program.
Sad, but true. Time for Americans to learn Japanese or Russian, it seems. At least with the Script Manager we'll still be able to use HyperCard.